package com.ruoyi.data.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.data.mapper.AttachMapper;
import com.ruoyi.data.domain.Attach;
import com.ruoyi.data.service.IAttachService;

/**
 * 附件Service业务层处理
 * 
 * @author haohao
 * @date 2025-07-14
 */
@Service
public class AttachServiceImpl implements IAttachService 
{
    @Autowired
    private AttachMapper attachMapper;

    /**
     * 查询附件
     * 
     * @param attachId 附件主键
     * @return 附件
     */
    @Override
    public Attach selectAttachByAttachId(Long attachId)
    {
        return attachMapper.selectAttachByAttachId(attachId);
    }

    /**
     * 查询附件列表
     * 
     * @param attach 附件
     * @return 附件
     */
    @Override
    public List<Attach> selectAttachList(Attach attach)
    {
        return attachMapper.selectAttachList(attach);
    }

    /**
     * 新增附件
     * 
     * @param attach 附件
     * @return 结果
     */
    @Override
    public int insertAttach(Attach attach)
    {
        attach.setCreateTime(DateUtils.getNowDate());
        return attachMapper.insertAttach(attach);
    }

    /**
     * 修改附件
     * 
     * @param attach 附件
     * @return 结果
     */
    @Override
    public int updateAttach(Attach attach)
    {
        attach.setUpdateTime(DateUtils.getNowDate());
        return attachMapper.updateAttach(attach);
    }

    /**
     * 批量删除附件
     * 
     * @param attachIds 需要删除的附件主键
     * @return 结果
     */
    @Override
    public int deleteAttachByAttachIds(Long[] attachIds)
    {
        return attachMapper.deleteAttachByAttachIds(attachIds);
    }

    /**
     * 删除附件信息
     * 
     * @param attachId 附件主键
     * @return 结果
     */
    @Override
    public int deleteAttachByAttachId(Long attachId)
    {
        return attachMapper.deleteAttachByAttachId(attachId);
    }
}
